


use Data/Individual_withsolar.dta, clear


	

	gen peersolar = cum - (has_solar/1000)

  
  
  
	label variable peersolar "Peer Solar Rooftops (000s)"
	label variable has_solar "Adopted Solar"
  
  
	label variable median_income_interp "Median Income (AUD 000s)"
	label variable median_mortgage_interp "Median Mortgage Payment (AUD 000s)"
	label variable median_rent_interp "Median Rental Payment (AUD 000s)" 
	label variable PBachelor_interp "Proportion Bachelor's Degree"
	label variable PRented_interp "Proportion Rental Properties"
	label variable median_rooms_interp "Median House Size"
	label variable PFullTime_interp "Proportion Employed Full Time"
	label variable median_age_interp "Median Age"
  
	xtset postcode





	local length = 3
		 
	forval t = 0(1)`length' {
		gen event_after`t' =  SHCP_end ==`t' |  PFIT_starttime==`t' | PFIT_endtime==`t' | ///
		 SRES1_end ==`t' | SRES2_end==`t' | SRES_TFIT_endtime==`t' | FFIT_endtime==`t'
		 
		 
		 gen event_before`t' =  SHCP_end ==-`t'  | PFIT_starttime==-`t' | PFIT_endtime==-`t' | ///
		 SRES1_end ==-`t' | SRES2_end==-`t' | SRES_TFIT_endtime==-`t' | FFIT_endtime==-`t'
		
		gen event_after_new`t' = event_after`t'*peersolar
		gen event_before_new`t' = event_before`t'*peersolar
		
		
		
		
		gen event_after_high`t' = event_after`t'*roofrelativeIV
		gen event_before_high`t' = event_before`t'*roofrelativeIV
		
		
		drop event_after`t'
		drop event_before`t'
		
		
		
		}
			
		
	* reference time 
	drop    event_after_new0 // event_before_high1 event_before_new1


	label variable event_before_new3  "Event period -3"
	label variable event_before_new2  "Event period -2"
	label variable event_before_new1  "Event period -1"
	label variable event_before_new0  "Event period "
	label variable event_after_new1   "Event period +1"
	label variable event_after_new2   "Event period +2"
	label variable event_after_new3   "Event period +3"

	
	
	
	

	xi: xtivreg2 green_p  event_before_new3 event_before_new2 event_before_new1 event_before_new0 ///
	event_after_new1  event_after_new2 event_after_new3 i.quarter   if ever_solar==0 &  roofrelativeIV<., fe cluster(postcode)

	eststo ma

	coefplot (ma, keep(event_before_new3  event_before_new2  event_before_new1) mcolor(blue) ciopts(lcolor(blue)) msymbol(o)) ///
	  (ma, keep(event_before_new0 ) mcolor(gs0) ciopts(lcolor(gs0)) msymbol(o)) ///
	 (ma, keep(  event_after_new1 event_after_new2 event_after_new3 ) mcolor(red) ciopts(lcolor(red)) msymbol(o)), vertical ///
	 relocate(event_before_new3 = -2.84 event_before_new2 = -1.84 event_before_new1 = -0.84 event_before_new0 = -0 ///
	event_after_new1 =0.84  event_after_new2=1.84 event_after_new3=2.84 )   legend(off) yline(0) ///
	xtitle("Event time") xlabel(-3(1)3)  xline(0, lcolor(gs10) lpattern(dash) lwidth(vthin)) yscale(range(-0.025 0.025)) ylabel(-0.02(0.01)0.02)

graph export Analysis/Motivation_individual.png, replace

	
	
	quietly summ green_plan if e(sample)
    local meandepvar=round(`r(mean)',.001)

	
	

outreg2 using Analysis/Individual_nosolar, bdec(3) se  nocons label  ctitle("FE")   ///
keep(event_before* event_after* )  addtext(Postcode FE, Yes, Year-Quarter FE, Yes, Mean dep var, 0`meandepvar' ) tex(fragment pretty) nonotes replace





	

	xi: xtivreg2 green_p  (event_before_new3 event_before_new2 event_before_new1 event_before_new0 ///
	event_after_new1  event_after_new2 event_after_new3  =   ///
	event_after_high3 event_after_high2 event_after_high1 event_before_high0 ///
	event_before_high1  event_before_high2 event_before_high3) i.quarter   if ever_solar==0 &  roofrelativeIV<., fe cluster(postcode)
	
	

outreg2 using Analysis/Individual_nosolar, bdec(3) se  nocons label  ctitle("IV")   ///
keep(event_before* event_after* )  addtext(Postcode FE, Yes, Year-Quarter FE, Yes, Mean dep var, 0`meandepvar' ) tex(fragment pretty) nonotes append

